package com.jbookstore.controller;

import javax.servlet.http.HttpSession;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.servlet.ModelAndView;

@Controller
public class CommonController {
	
	// log4j
	static public Logger logger = Logger.getLogger(CommonController.class);
	
	@Autowired
	protected HttpSession session;

	// error handler
	public ModelAndView errorHandler(Exception e) {

		String msg = "에러 입니다.";
		
		ModelAndView mav = new ModelAndView();
		mav.addObject("errorMsg", msg);
		mav.setViewName("/error/error");

		return mav;
	}
	
	//Session get
	protected HttpSession getHttpSession() {
		return this.session;
	}
}
